package com.xiao.wiki.service;

import com.xiao.wiki.domain.Doc;
import com.xiao.wiki.websocket.WebSocketServer;
import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ：降蓝
 * @description：异步化发送消息
 * @date ：2022/9/17 10:21
 */
@Service
public class WsService {

    @Resource
    WebSocketServer webSocketServer;

    // 推送消息
    @Async
    public void sendInfo(String message,String logId) {
        MDC.put("LOG_ID",logId);
        webSocketServer.sendInfo(message);
    }
}
